package com.cluster.platform.controller;

import com.cluster.platform.common.api.CommonResult;
import com.cluster.platform.dto.CmsContentDetailsDto;
import com.cluster.platform.service.CmsContentsInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: CmsContentsInfoController
 */
@RestController
@Api(tags = "文章内容接口", value = "CmsContentsInfoController")
@RequestMapping("/cmsContents")
public class CmsContentsInfoController {

    @Autowired
    CmsContentsInfoService cmsContentsInfoService;

    @ApiOperation("发布文章")
    @RequestMapping(value = "/addContents", method = RequestMethod.POST)
    CommonResult<Object> addContents(@RequestBody CmsContentDetailsDto cmsContentDetailsDto) {
        return cmsContentsInfoService.addCmsContentsInfo(cmsContentDetailsDto);
    }

    @ApiOperation("查询文章详细内容")
    @GetMapping("/searchContentDetail")
    CommonResult<Object> searchContentDetail(@RequestParam("contentId") String contentId) {
        return cmsContentsInfoService.searchContentDetail(contentId);
    }

    @ApiOperation("查询文章概要信息")
    @GetMapping("/searchCmsContentInfo")
    CommonResult<Object> searchCmsContentInfo(@RequestParam("id") String id){
        return cmsContentsInfoService.searchCmsContentInfo(id);
    }

    @ApiOperation("查询文章所有信息")
    @GetMapping("/searchCmsContent")
    CommonResult<Object> searchCmsContent(@RequestParam("id")String id) {
        return cmsContentsInfoService.searchCmsContent(id);
    }

}
